#include "IngredientContainer.h"
#include <jni.h>
IngredientContainer ingrContainer;
extern "C" {
int allocateNewIngredient(const char*, double, int, int);
	jstring
	Java_com_cs474_cupcakes7_Main_stringFromJNI(JNIEnv* env, jobject thiz) {
		return env->NewStringUTF("Hello world, from C++!");

	}
	// Takes parameters
	//  string name, double amount, int unit, int type
	jstring
	Java_com_cs474_cupcakes7_AddIngredient_newIngredient(JNIEnv* env, jobject objt,
			jstring n, jdouble am, jint un, jint ty) {

		const char *name = env->GetStringUTFChars( n, 0);
		allocateNewIngredient(name, am, un, ty);
		return env->NewStringUTF( "Allocated a new Ingredient");
	}
}

int allocateNewIngredient(const char* n, double am, int un, int ty)
{
	char name[100];
	strcpy(name, n);
	ingrContainer.allocateNewIngredient(name, am, un, ty);
}
